<?php ob_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>YuTori PHP Framework Debug Console</title>
<style type="text/css">
/* <![CDATA[ */
body { font-size: 100%; }
h1 { font-size: 130%; font-weight: bold; background-color: #aeaeff; margin: 0px 0px 10px 0px; padding: 3px; }
h2 { background-color: #ccccfd; font-size: 100%; font-weight: bold; margin: 0px; padding: 5px; }
dl {margin: 0px; padding: 0px; border-bottom: 1px solid #aeaeae;}
dt, dd { margin: 0px; padding: 3px 1px; }
dt { color:red; width: 200px; float:left; clear:left; }
dd { border-top: 1px solid #aeaeae; padding-left: 200px; }
/* ]]> */
</style>
</head>
<body>
<h1>YuTori PHP Framework Debug Console</h1>
<h2>システム情報</h3>
<dl>
<dt>処理時間</dt><dd><?php printY('Logger.getTime')?> sec.</dd>
<dt>メモリ使用量</dt><dd><?php printY('Logger.getMemory')?> byte</dd>
<dt>メモリ使用量(peak)</dt><dd><?php printY('Logger.getMemoryPeak')?> byte</dd>
</dl>

<h2>トレースログ</h3>
<dl>
<?php foreach ((array)Y('Logger.getDebug') as $Log) { ?>
<dt><?php print $Log['trace'];?></dt><dd><?php print nl2br(htmlspecialchars(trim($Log['txt'])). '<br />'.$Log['time'].'sec. ');?></dd>
<?php
}
?>
</dl>
<br />
<?php
printY ('Logger.objTree');

$LogTxt = ob_get_contents();
ob_end_clean();
if (Y('Logger.Output') == 'javascript') {
	// 文字列のエスケープ処理
	$LogTxt = str_replace ("\r", '', $LogTxt);
	$LogTxt = str_replace ("\n", '\n', addslashes($LogTxt));
?>

<script type="text/javascript">
// <![CDATA[
    if ( self.name == '' ) {
       var title = 'Console';
    } else {
       var title = 'Console_' + self.name;
    }
    _smarty_console = window.open("",title.value,"width=680,height=600,resizable,scrollbars=yes");
    _smarty_console.document.write('<?php print $LogTxt; ?>');
    _smarty_console.document.close();
// ]]>
</script>

<?php
} else {
	print $LogTxt;
}
?>